Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new-changelog to Makefile #8104

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

kaovilai
Copy link
Contributor

@kaovilai kaovilai commented Aug 11, 2024

Signed-off-by: Tiger Kaovilai [email protected]

Thank you for contributing to Velero!

Please add a summary of your change

Make it easier to create new changelog file correctly.

Example usage:

~/git/velero makefile-changelog*
❯ make new-changelog 
"Add new-changelog to Makefile" added to ./changelogs/unreleased/8104-kaovilai

~/git/velero makefile-changelog*
❯ make new-changelog CHANGELOG_BODY="Changes you have made" 
"Changes you have made" added to ./changelogs/unreleased/8104-kaovilai

Does your change fix a particular issue?

Fixes #7865

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

@kaovilai
Copy link
Contributor Author

/kind changelog-not-required

@github-actions github-actions bot added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Aug 11, 2024
@kaovilai kaovilai force-pushed the makefile-changelog branch 6 times, most recently from 9328bfe to d20f82a Compare August 11, 2024 20:39
Copy link

codecov bot commented Aug 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.01%. Comparing base (cc32375) to head (0b44777).
Report is 93 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8104      +/-   ##
==========================================
+ Coverage   58.77%   59.01%   +0.23%     
==========================================
  Files         358      364       +6     
  Lines       30070    30270     +200     
==========================================
+ Hits        17674    17864     +190     
- Misses      10949    10960      +11     
+ Partials     1447     1446       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# make new-changelog CHANGELOG_BODY="Changes you have made"
new-changelog: GH_LOGIN ?= $(shell gh pr view --json author --jq .author.login 2> /dev/null)
new-changelog: GH_PR_NUMBER ?= $(shell gh pr view --json number --jq .number 2> /dev/null)
Copy link
Contributor

@reasonerjt reasonerjt Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never used gh cmd, but is this always reliable? Could you explain what does it do? If I have multiple PRs opened and none of them has changelog file, does it get the right PR number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's reliable. It's GitHub's own CLI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets the right PR number for me.

I could add more vars here for base branch for those who work on other downstream but for folks with their fork and tanzu this should work out of the box.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is to curl against GitHub rest API

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's based on the current branch you checked out. GitHub will check if the branch is used as a PR against upstream.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaovilai we'd need to document somewhere that users need to install the github CLI, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 382 count?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah -- that's probably good enough. And this is an optional task that's not called anywhere else, so if it's not there, it won't matter as long as this task isn't executed explicitly.

sseago
sseago previously approved these changes Aug 19, 2024
@kaovilai
Copy link
Contributor Author

FYI: I don't really need this any more.. especially if no one else find use of it.
I have made it a zsh function in my own dotfiles so it is not necessary to merge this. :)

@kaovilai
Copy link
Contributor Author

https://github.com/kaovilai/dotfiles/blob/master/zsh/util.zsh#L21

@blackpiglet
Copy link
Contributor

This PR is valuable to me, but I think we need to document more details on how to use it.

In my test, it seems need to create a PR first, then run the added make command.

gh pr create --title 'Title name' --body 'PR body' --label 'label-name-1'

make new-changelog

Makefile Show resolved Hide resolved
@kaovilai
Copy link
Contributor Author

@blackpiglet done.

@blackpiglet
Copy link
Contributor

Thanks for your effort.
The content looks good.
Please squash the commits and resolve the DCO error.

Signed-off-by: Tiger Kaovilai <[email protected]>
@blackpiglet blackpiglet merged commit 1110853 into vmware-tanzu:main Sep 11, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Makefile target to help create changelog file.
5 participants